home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F34128_buildListWhileMap.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-20  |  3.6 KB  |  97 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:saxon="http://icl.com/saxon"
  3. exclude-result-prefixes="xsl msxsl"
  4. >
  5.  
  6.   <xsl:template name="buildListWhileMap">
  7.     <xsl:param name="pGenerator" select="/.."/>
  8.     <xsl:param name="pParam0" select="/.."/>
  9.     <xsl:param name="pController" select="/.."/>
  10.     <xsl:param name="pContollerParam" select="/.."/>
  11.     <xsl:param name="pMap" select="/.."/>
  12.     <xsl:param name="pMapParams" select="/.."/>
  13.     <xsl:param name="pElementName" select="'el'"/>
  14.     <xsl:param name="pList" select="/.."/>
  15.     <xsl:param name="pBaseList" select="/.."/>
  16.  
  17.     <xsl:if test="not($pController)">
  18.       <xsl:message terminate="yes">
  19.       [buildListWhileMap]Error: No pController specified:
  20.          would cause infinite processing.
  21.       </xsl:message>
  22.     </xsl:if>   
  23.     
  24.     <xsl:variable name="vNewBaseListElement">
  25.       <xsl:if test="$pMap">
  26.           <xsl:element name="{$pElementName}">
  27.               <xsl:apply-templates select="$pGenerator">
  28.                 <xsl:with-param name="pParams" select="$pParam0"/>
  29.                 <xsl:with-param name="pList" select="$pBaseList"/>
  30.               </xsl:apply-templates>
  31.           </xsl:element>
  32.       </xsl:if>
  33.     </xsl:variable>
  34.     
  35.     
  36.     <xsl:variable name="vElement">
  37.       <xsl:element name="{$pElementName}">
  38.         <xsl:choose>
  39.             <xsl:when test="not($pMap)">
  40.               <xsl:apply-templates select="$pGenerator">
  41.                 <xsl:with-param name="pParams" select="$pParam0"/>
  42.                 <xsl:with-param name="pList" select="$pList"/>
  43.               </xsl:apply-templates>
  44.            </xsl:when>
  45.            <xsl:otherwise>
  46.               <xsl:apply-templates select="$pMap">
  47.                 <xsl:with-param name="pParams" select="$pMapParams"/>
  48.                 <xsl:with-param name="pDynParams" select="saxon:node-set($vNewBaseListElement)/*"/>
  49.                 <xsl:with-param name="pList" select="$pList"/>
  50.               </xsl:apply-templates>
  51.           </xsl:otherwise>
  52.       </xsl:choose>
  53.       </xsl:element>
  54.     </xsl:variable>
  55.     
  56.     <xsl:variable name="newList">
  57.       <xsl:copy-of select="$pList"/>
  58.       <xsl:copy-of select="saxon:node-set($vElement)/*"/>
  59.     </xsl:variable>
  60.      
  61.      <xsl:variable name="newRTFBaseList">
  62.       <xsl:copy-of select="$pBaseList"/>
  63.       <xsl:copy-of select="saxon:node-set($vNewBaseListElement)/*"/>
  64.     </xsl:variable>
  65.     
  66.     <xsl:variable name="vResultList" select="saxon:node-set($newList)/*"/>
  67.     <xsl:variable name="vResultBaseList" select="saxon:node-set($newRTFBaseList)/*"/>
  68.     
  69.     <xsl:variable name="vAccept">
  70.       <xsl:apply-templates select="$pController">
  71.         <xsl:with-param name="pList" select="$vResultList"/>
  72.         <xsl:with-param name="pParams" select="$pContollerParam"/>
  73.       </xsl:apply-templates>
  74.     </xsl:variable>
  75.     
  76.     <xsl:choose>
  77.       <xsl:when test="not(string($vAccept))">
  78.         <xsl:copy-of select="$pList"/>
  79.       </xsl:when>
  80.       <xsl:otherwise>
  81.         <xsl:call-template name="buildListWhileMap">
  82.             <xsl:with-param name="pGenerator" select="$pGenerator"/>
  83.             <xsl:with-param name="pParam0" select="$pParam0"/>
  84.             <xsl:with-param name="pController" select="$pController"/>
  85.             <xsl:with-param name="pContollerParam" select="$pContollerParam"/>
  86.             <xsl:with-param name="pMap" select="$pMap"/>
  87.             <xsl:with-param name="pMapParams" select="$pMapParams"/>
  88.             <xsl:with-param name="pElementName" select="$pElementName"/>
  89.             <xsl:with-param name="pList" select="$vResultList" />
  90.             <xsl:with-param name="pBaseList" select="$vResultBaseList"/>
  91.  
  92.         </xsl:call-template>
  93.       </xsl:otherwise>
  94.     </xsl:choose>
  95.  
  96.   </xsl:template>
  97. </xsl:stylesheet>